package cn.wolfcode.luowowo.article.query;

import cn.wolfcode.luowowo.article.domain.Travel;
import cn.wolfcode.luowowo.common.query.QueryObject;
import lombok.Getter;
import lombok.Setter;

@Setter
@Getter
public class TravelQuery extends QueryObject {

    //游记状态,默认为发布
    private int state = Travel.STATE_RELEASE;

    //游记状态,默认为公开
    private boolean isPublic = true;

    private Long destId = -1L;
    //天数范围
    private int dayType = -1;
    //旅游月份
    private int travelTimeType = -1 ;
    //旅游耗钱
    private int perExpendType = -1 ;
    //排序
    private int orderType = 1;

    //排序规则
    public String getOrderBy() {
        return orderType == 1 ? "t.createTime desc ":"t.viewnum desc";
    }

    public TravelCondition getDays() {
        return TravelCondition.DAYS_MAP.get(dayType);
    }
    public TravelCondition getTravelTime() {
        return TravelCondition.TRAVEL_TIME.get(travelTimeType);
    }
    public TravelCondition getPerExpend() {
        return TravelCondition.TRAVEL_PRE_EXPENDS.get(perExpendType);
    }



}
